Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] Add _flow.js for component tests. #2342

Merged
merged 7 commits into from May 22, 2017
Merged

[web] Add _flow.js for component tests. #2342

merged 7 commits into from May 22, 2017

Conversation

MatthewShao
Copy link
Contributor

Suggested by @mhils here, we add a python test to generate js/__tests__/ducks/_flow.js for the components tests. In this way, each time when we run the python test, it will produce a generator function for our js tests.

tflow_json = _json.dumps(
app.flow_to_json(tflow.tflow(resp=True, err=True)), indent=4, sort_keys=True
)
web_root = os.path.join(os.getcwd(), 'web')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cwd is a bit dangerous as this may change depending on where you execute your tests. Use this and construct the path relative from here. :)

@@ -1,101 +1,101 @@
import React from 'react'
import renderer from 'react-test-renderer'
import * as Columns from '../../../components/FlowTable/FlowColumns'
import { TFlow } from '../../ducks/tutils'
import _tflow from '../../ducks/_tflow'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to have tflow as a "public" module or do we want to integrate it in tutils? I was thinking of the following in tutils:

export {default as TFlow} from './_tflow'

Both really works, go with what you prefer. 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good point! I would like to integrate all the test mock object into tutils.js

@@ -8,7 +8,7 @@ export default function(){
"alpn_proto_negotiated": "http/1.1",
"cipher_name": "cipher",
"clientcert": null,
"id": "75bfd3cd-a084-4d84-a063-b0804dc91342",
"id": "4a18d1a0-50a1-48dd-9aa6-d45d74282939",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this commit is helpful in unintended ways. We need to set the ids and timestamps to constant values before exporting, otherwise this file will always be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check if there is any other value would be changed from time to time, and give a constant value in the Python test.

@mhils mhils merged commit 5626c38 into mitmproxy:master May 22, 2017
@mhils
Copy link
Member

mhils commented May 22, 2017

👍 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants